<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="./css/home.css">
  <title>搜索</title>
  <style>
      .loadinglast{
        display: none;
      }
      body{
        background: #FFEBEB;
      }
  </style>
</head>
<body>
  
  <div class="root">
    <!-- 头部logo -->
    <div class="top-container">
      <div class="top-header">
        <span class="logo-icon" onclick="javascript:window.location.href='./index.html'"><img src="./image/head_logo.png"></span> <span class="line-height"></span> <span class="logo-text" onclick="javascript:window.location.href='./index.html'"><img src="./image/head_logo_text.svg"></span>
        <div class="header-right">
          <span class="head-parentbaby"><img src="./image/head_parentbaby.svg" alt=""></span>
          <div class="head-search">
            <p>互联网+婴幼儿照护服务第一平台</p>
            <input id="search_keyword" type="text" placeholder="搜索">
            <div class="search_button" onclick="location.href = 'search.html?text='+$('#search_keyword').val();">
              <img src="./image/search_icon.png" alt="">
            </div>
          </div>
          <p class="head-wechat">
            <img src="./image/erweima.png" alt=""> <span>托育机构备案系统</span>
          </p>
          <p class="head-wechat">
            <img src="./image/erweima.jpg" alt=""> <span>官方微信公众号</span>
          </p>
        </div>
      </div>
    </div>
  </div>

  <div class="nav-container">
		<ul class="nav">
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/zhengcefagui.html">政策法规</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/xinwendongtai.html">新闻动态</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/care_organization.html">托育机构</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/zhiliangpinggulanmuye.html">质量评估</a></li>
			<li class="nav-menu-1 selected_background"><a class="nav-link" href="index.html">人才评价</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://chinazhfw.cn/NursingServices/front/html/zhaohuketang.html?type=4">照护课堂</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/muyingchanpin.html">母婴产品</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/muyingsheshi.html">母婴设施</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/zhuanjiazhiku.html?type=7">专家智库</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/signin.html">统计分析</a></li>
			<li class="nav-menu-1"><a class="nav-link" target="_blank" href="https://www.chinazhfw.cn/NursingServices/front/html/guide_supervise.html">意见反馈</a></li>
		</ul>
	</div>

  <div class="searchPage">
    <div class="cont-cont">
      <div class="content-all">
        <div class="sousuo-head-title">查询结果</div>

        <div class="head-search1">
          <input id="search_keyword1" type="text" placeholder="搜索">
          <div class="search_button1">
            <img src="./image/search_icon.png" alt="">
          </div>
        </div>

        <div class="content-right01" id="content-righta">

          <div class="contentList">
            
            <div class="contentTle">
              <p class="releTle">标题</p>
              <p class="release">发布日期</p>
            </div>

            <div id="insertion"></div>

            <div class="figure">

              <div class="no" style="text-align: center;margin-top: 50px;font-size: 16px;">暂无数据</div>

              <div class="loadinglast">
                <img src="./img/loadinglast.png" alt="">
                <p class="wait">请稍等~</p>
              </div>

              <div class="figureList siteList"></div>
        
            </div>

          </div>

          <div id="content-page" style="text-align: center;"></div>
        </div>

      </div>
    </div>
  </div>

  <div class="scrollTop">
    <a href="index.html">
      <img src="./image/home.png" title="返回主页" alt="">
    </a>
    <a class="returnTop" title="返回顶部">
      <img src="./image/top.png" alt="">
    </a>
  </div>

  <script src="https://www.jz1x.com/js/jquery.min.js?v=2.1.4"></script>
  <script>

    function GetQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        //如果地址栏中出现中文则进行编码
        var r = encodeURI(window.location.search).substr(1).match(reg);
        if (r != null) {
            //将中文编码的字符重新变成中文
            return decodeURI(unescape(r[2]));
        }
        return null;
    }

    $(document).ready(function(){
      var text = GetQueryString('text');
      $("#search_keyword1").val(text);
      if(text) changeSearch()
    });

    $("#search_keyword1").keyup(function(ev){
      let e = ev || window.event;
        if( e.keyCode == 13 ){
          changeSearch();
        }
    })

    $(".search_button1").click(function(){
      changeSearch()
    })

    function changeSearch(){
        $(".no").hide();
        $(".loadinglast").show();
        $.get('https://jzmy.jz1x.com/jinZhiIndex/articleDetails', {
          titleName:$("#search_keyword1").val()
        },
        function (data) {
          let str = ``;
          if( data.code == 0 ){
            $(".loadinglast").hide();
            data.data.forEach(element => {
              str += `
                <div class="contentLink">
                  <a href="articleInfo.html?id=${element.id}">
                    <p class="releTle">${element.title}</p>
                    <p class="release">${element.checkerDate}</p>
                  </a>
                </div>
              `
            });
          }
          $("#insertion").html(str);
          // putInfo(data)

        })
    }

    function putInfo(data){

    // 分页
    layui.use(['laypage'], function () {
      var laypage = layui.laypage;

      //自定义样式
      laypage.render({
        elem: 'content-page', //容器ID
        count: data.data.indexListCount, //共有多少条数据
        limit: limit, //每页显示的数据
        curr: page,
        theme: '#FF73AA',
        layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
        jump: function(obj,first){
          page = obj.curr
          limit = obj.limit
          if( !first ){
            announcement($(".contentActive").attr('data-tis'));
          }
        }, //回调函数，用于发生其他改变
        first: '首页',
        last: '尾页',
      })
    })

    }

    // 回到顶部
    $(".returnTop").click(function () {

    $("html,body").animate({
      scrollTop: '0px',
    }, 300);

    })

  </script>

</body>
</html>